<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Permission;

class IndexController extends Controller
{
    //
    protected function index(){
    	
		$list =  Permission::where('status',1)->orderBy('sort','desc')->select('id','name','display_name','pid','icon')->get()->toarray();
		$a = array2tree($list);
    	return view('admin/index/index',['list'=>$a]);
    }
	
    protected function main(){

        $version = DB::select('SELECT VERSION() AS ver');
        $config  = [
            'url'             => $_SERVER['HTTP_HOST'],
            'document_root'   => $_SERVER['DOCUMENT_ROOT'],
            'server_os'       => PHP_OS,
            'server_port'     => $_SERVER['SERVER_PORT'],
            'server_ip'       => $_SERVER['SERVER_ADDR'],
            'server_soft'     => $_SERVER['SERVER_SOFTWARE'],
            'php_version'     => PHP_VERSION,
            'mysql_version'   => $version[0]->ver,
            'max_upload_size' => ini_get('upload_max_filesize')
        ];
    	return view('admin/index/main',['config' => $config]);
    }
		
	
}
